<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="{$core['describe']}">
    <meta name="author" content="Webpixels">
    <title>{$title}</title>
    <!-- Favicon -->
    <link rel="icon" href="__PUBLIC__/../favicon.ico" type="image/png">
    <!-- Font Awesome 5 -->
    <link rel="stylesheet" href="//cdn.bootcdn.net/ajax/libs/font-awesome/5.15.3/css/all.min.css">
    <!-- Purpose CSS -->
    <link rel="stylesheet" href="__PUBLIC__/uikit/css/purpose.css" id="stylesheet">
    <link href="__PUBLIC__/Xadmin/lib/layui/css/modules/layer/default/layer.css" rel="stylesheet">
    <style>
        /*从左滑到右*/
        @keyframes fadeleftIn {
            0% {
                -webkit-transform: translate3d(100%, 0, 0);
                -webkit-transform: translate3d(100%, 0, 0);
                transform: translate3d(100%, 0, 0);
                transform: translate3d(100%, 0, 0);
            }
            100% {
                -webkit-transform: none;
                transform: none;
            }
        }

        /*抖动效果*/

        @keyframes dou {
            0% {
                transform: rotate(4deg);
            }
            50% {
                transform: rotate(-4deg);
            }
            100% {
                transform: rotate(0deg);
            }
        }

        /*放大弹出*/
        @keyframes popIn {
            0% {
                -webkit-transform: scale3d(0, 0, 0);
                transform: scale3d(0.5, 0.5, 0.5);
                opacity: 0;
            }
            50% {
                -webkit-animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);
                animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);
            }
            100% {
                -webkit-transform: scale3d(1, 1, 1);
                transform: scale3d(1, 1, 1);
                -webkit-animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
                animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
                opacity: 1;
            }
        }

        .portrait {
            width: 47px;
            height: 47px;
            border-radius: 7px;
            vertical-align: middle;
            margin-right: 11px;
        }

        .popIn {
            animation: popIn .6s;
        }

        .form-group {
            animation: popIn .4s;
        }

        .fadeleftIn {
            animation: fadeleftIn .4s;
        }

        .btn-soft-primary:hover {
            color: #6e00ff;
            background-color: #e2ccff;
            border-color: #6e00ff;
            -webkit-box-shadow: 0 4px 11px rgba(226, 204, 255, .35);
            box-shadow: 0 4px 11px rgba(226, 204, 255, .35)
        }
    </style>
</head>

<body class="application application-offset ready">
<!-- Application container -->
<div class="container-fluid container-application">
    <!-- Sidenav -->
    <!-- Content -->
    <div class="main-content position-relative">
        <!-- Page content -->
        <div class="page-content">
            <div class="min-vh-100 py-5 d-flex align-items-center">
                <div class="w-100">
                    <div class="row justify-content-center">
                        <div class="col-sm-10 col-lg-10">
                            <div class="card shadow zindex-100 mb-5">
                                <div class="card-body px-md-5 py-5">
                                    <div class="mb-0 fadeleftIn">
                                        <h6 class="h3"
                                            style="white-space: nowrap;overflow: hidden;text-overflow:ellipsis;"><img
                                                src="http://q.qlogo.cn/headimg_dl?dst_uin={$data['info']['qq']}&spec=640&img_type=jpg"
                                                class="portrait"/>{$data['info']['nickname']}</h6>
                                        <p class="text-muted mb-0">由 <b>{$core['title']}</b> 提供技术服务</p>
                                    </div>
                                    <hr/>
                                    <form id="pay_form" action="/submit" method="post">
                                        <input type="hidden" id="pay_code" value="{$data['info']['code']}" name="code"
                                               placeholder="不要试图修改这个，否则造成财产损失后果自负！">
                                        <input type="hidden" id="pay_token" value="{$Request.token}" name="__token__"/>
                                        <input type="hidden" id="pay_type" name="type">

                                        <div class="form-group mb-2">
                                            <label class="form-control-label">付款金额</label>
                                            <div class="input-group">
                                                <div class="input-group-prepend">
                                                <span class="input-group-text"
                                                      style="height: 100px;font-weight: bold;font-size: 24px">￥</span>
                                                </div>
                                                <input type="text" style="height: 100px;font-size: 32px"
                                                       class="form-control" name="money" id="pay_money"
                                                       placeholder="0.00">
                                                <div class="input-group-append">

                                                </div>
                                            </div>
                                        </div>
                                        {if condition="$data['preselection_switch']"}
                                        <div class="form-group mb-2">
                                            <div class="input-group">
                                                <div class="btn-toolbar">
                                                    {for start="0" end="6"}
                                                    {if condition="isset($data['info']['preselection_money'][$i]) && trim($data['info']['preselection_money'][$i])!='' && $data['info']['preselection_money'][$i]!=NULL"}
                                            <button type="button" class="btn btn-lg input-group-text preselection" style="font-size: 20px" value="{$data['info']['preselection_money'][$i]}">￥{$data['info']['preselection_money'][$i]}</button>
                                                    {/if}
                                                    {/for}
                                                </div>
                                            </div>
                                        </div>
                                        {/if}
                                        <div class="form-group mb-2">
                                            <label class="form-control-label">支付方式</label>
                                            <div class="input-group">
                                                <div class="btn-toolbar">
                                                    {foreach name="data['pay_list']" item="v" key="key"}
                                                    {if condition="$v['switch']"}
                                                    <button type="button" onclick="change_type(this)"
                                                            value="{$v['alias']}"
                                                            class="btn btn-lg {$v['active']? 'btn-primary' : 'btn-soft-primary'} btn-type">
                                                        <img style="vertical-align:middle"
                                                             src="__PUBLIC__/icon/{$v['icon']}" width="20"/>&nbsp;{$v['name']}
                                                    </button>
                                                    {/if}
                                                    {/foreach}
                                                </div>

                                            </div>
                                        </div>
                                        <div class="form-group mb-2">
                                            <div class="input-group">
                                                <input type="text"
                                                       class="form-control" name="remarks" id="pay_remarks"
                                                       placeholder="备注信息" style="height: 38px;font-size: 15px">
                                                <div class="input-group-append">

                                                </div>
                                            </div>
                                        </div>
                                        <br/>
                                        <button type="button" class="btn btn-primary btn-block popIn" id="form_but">
                                            立即支付
                                        </button>
                                </div>
                                </form>

                                <div class="card-footer px-md-5"><small>我也想要一个这样的聚合收银台 → </small>
                                    <a href="/register/" class="small font-weight-bold">立即注册</a></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- Footer -->
    </div>
</div>
<!-- Scripts -->
<script type="text/javascript" src="//lib.baomitu.com/jquery/3.6.0/jquery.min.js"></script>
<script src="__PUBLIC__/uikit/js/purpose.js"></script>
<script src="__PUBLIC__/Xadmin/lib/layui/lay/modules/layer.js"></script>
<script>
    $("#pay_type").val($(".btn.btn-lg.btn-primary.btn-type").val());

    function change_type(e) {
        $(".btn-type").attr("class", "btn btn-lg btn-soft-primary btn-type");
        $(e).attr("class", "btn btn-lg btn-primary btn-type");
        var type = $(e).val();
        $("#pay_type").val(type);
    }

    $("#form_but").click(function () {
        if ($("#pay_type").val() == "" || !$("#pay_type").val()) {
            layer.msg("请选择支付方式");
            return;
        }
        if (checkPrice($("#pay_money").val())) {
            layer.msg("发起支付");
            $("#pay_form").submit();
        } else {
            layer.msg("请正确输入金额");
        }
    });
    $(".preselection").click(function (){
       var val = $(this).val();
       if (checkPrice(val)) {
           $("#pay_money").val(val);
       }
    });

    function checkPrice(value) {
        var reg = /^[+-]?[1-9]?[0-9]*\.[0-9]*$/, reg1 = /^[0-9]*[1-9][0-9]*$/;
        if (!reg1.test(value) && !reg.test(value) && value !== "0") {
            return false
        } else if (reg.test(value) && value.split(".")[1].length > 2 || value * 1 < .01 && type == 2 || reg.test(value) && value.split(".")[1].length == 0) {
            return false
        }
        return true
    }
</script>
</body>
</html>